Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): prevent overflow in count modifier #10930

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

RoloEdits
Copy link
Contributor

Current behavior allowed a user to input a more than reasonable value for count, where it could grow till the full value was larger than the allotted render width, and could eventually overflow.

This pull request takes guidance from this comment by @the-mikedavis and caps the value to be below 100,000,000. This would leave the full value viewable and prevent any overflow.

There were other options, such as converting to a string first to check the length, and then dropping the digit that would grow past the allotted render width, keeping a rolling in-render value, but this would add an allocation each time even when not going beyond the selected size.

Ultimately, it was decided that this would be a low percentage issue, and thus not worth an allocation or complexity something like that would add.

To note, the render width is 15 characters wide. 100,000,000 was chosen from guidance, but 999,999,999,999,999 would be the highest value within the 15 character size constraint.

Current:
master_overflow_behavior

PR:
helix_term_prevent_overflow

Fixes: #10922

@RoloEdits RoloEdits changed the title fix(editor): prevent overflow in movement count fix(editor): prevent overflow in count modifier Jun 11, 2024
@pascalkuthe pascalkuthe merged commit 9c479e6 into helix-editor:master Jun 13, 2024
6 checks passed
@RoloEdits RoloEdits deleted the editor-count-overflow branch June 14, 2024 04:39
AOx0 pushed a commit to AOx0/helix that referenced this pull request Jun 15, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
mxxntype pushed a commit to mxxntype/helix that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Weird behavior with high number modifiers
3 participants